<template>

	<body>
		<div class="loan_nav col_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>我要认证</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">

		</div>
		<div class="verify">
			<p>个人资料核实</p>
		</div>
		<div class="verify_form">
			<ul>
				<li>
					<p>真实姓名</p>
				</li>
				<li><input v-model="params.fullName" type="text" placeholder="请输入真实姓名" /></li>
			</ul>
			<ul>
				<li>
					<p>身份证号</p>
				</li>
				<li><input v-model="params.identityId" maxlength="18" type="text" placeholder="请输入身份证号" /></li>
			</ul>
		</div>
		<div v-if="!isAuth" class="btn">
			<a @click="save"><input type="button" value="我要认证" class="col-green" /></a>
		</div>
	</body>
</template>

<script>
export default {
	data() {
		return {
			params: {
				fullName: '',
				identityId: ''
			},
			isAuth: false
		}
	},
	created() {
		this.query()
	},
	methods: {
		query() {
			this.$http.get('/app/member/userInfo').then(json => {
				const { code, user } = json
				if (code === 0) {
					this.params.fullName = user.memberName
					this.params.identityId = user.cardNo
					if(user.memberName) this.isAuth = true
				}
			})
		},
		save() {
			this.$http.post('/app/member/authentication', this.params).then(json => {
				const { code } = json
				if(code === 0) {
					this.$vux.toast.show({ text: '认证成功' })
					this.$router.go(-1)
				}
			})
		}
	}
}
</script>

<style>

</style>